<?php
	/**
	 *  版本更新信息
	 */
	
    class Update extends APIBase {
		
		public $tag = "Update";
		public $isLogin = false;
		
		public function before() {
			$this->initMysql();
			return true;
		}

		public function logic() {

			if (!isset($this->param['vercode'])&& $this->param['vercode'] =='') {
				//$vercode = "1";
				$this->returnError(701, "vercode is needs");
            }else{
				$vercode=$this->param['vercode'];	
            }
             
			$row = $this->mysql->find("select * from `version` where 1 = 1 ORDER BY `id` DESC LIMIT 0,1");
			$code = $row[0]['verCode'];
			/*if((int)$code==(int)$vercode){
				$this->returnError(702, "Has been the latest version");
			}*/
			
			
			$verinfo = array();
			$verinfo["app"] = $row[0]['app'];
			$verinfo["url"] = $row[0]['url'];
			$verinfo["verName"] = $row[0]['verName'];
			$verinfo["verCode"] = $row[0]['verCode'];				
			$verinfo["apkSize"] = $row[0]['apkSize'];
			$verinfo["isForce"] = $row[0]['force'];
			$this->returnData($verinfo);
		}
		
    	public function after() {
			
			$this->deinitMysql();
		}
    }
?>
